package com.rs.game.player.dialogues;

import com.rs.Settings;
import com.rs.cache.loaders.NPCDefinitions;
import com.rs.game.WorldTile;
import com.rs.game.player.controlers.StartTutorial;

public class QuestGuide extends Dialogue {

	int npcId;
	StartTutorial controler;

	@Override
	public void start() {
		npcId = (Integer) parameters[0];
		controler = (StartTutorial) parameters[1];
		if(controler == null) {
			player.getPackets().sendGameMessage("Enjoy your stay at Geryon!", false);
		} else {
			int s = controler.getStage();
		    if(!player.isDoneTutorial()) {
			if (s == 0) {
				sendEntityDialogue(
						SEND_2_TEXT_CHAT,
						new String[] {
								NPCDefinitions.getNPCDefinitions(npcId).name,
"Ahhh... Yes... Yes... I figured you'd be along shortly..." },
						IS_NPC, npcId, 9827);
			}
		}
		}
	}
	@Override
	public void run(int interfaceId, int componentId) {
		if (!(controler == null)) {
		} if (stage == -1) {
			stage = 0;
			sendPlayerDialogue(Expressions.NORMAL, "Uh.. They did? Where am I? Who are you? What am I doing here?!");
		} else if (stage == 0) {
			stage = 1;
			sendEntityDialogue(SEND_4_TEXT_CHAT,new String[] {NPCDefinitions.getNPCDefinitions(npcId).name,"Ahhh.. Yes.." }, IS_NPC,npcId, 9827);
		} else if (stage == 1) {
			stage = 2;
			sendPlayerDialogue(Expressions.NORMAL, "WHAT? Where on Geilinior AM I!?");
		} else if (stage == 2) {
			stage = 3;
			sendEntityDialogue(SEND_4_TEXT_CHAT,new String[] {NPCDefinitions.getNPCDefinitions(npcId).name,"Not to fear, the memory loss.." }, IS_NPC,npcId, 9827);
		} else if (stage == 3) {
			stage = 4;
			sendEntityDialogue(SEND_4_TEXT_CHAT,new String[] {NPCDefinitions.getNPCDefinitions(npcId).name,"It's usually not permanent.." }, IS_NPC,npcId, 9827);
		} else if (stage == 4) {
			stage = 5;
			sendPlayerDialogue(Expressions.NORMAL, "WHAT?! Memory loss? I demand answers!");
		} else if (stage == 5) {
			stage = 6;
			sendEntityDialogue(SEND_4_TEXT_CHAT,new String[] {NPCDefinitions.getNPCDefinitions(npcId).name,"There's no time for that adventurer, I need you." }, IS_NPC,npcId, 9827);
		} else if (stage == 6) {
			stage = 7;
			sendPlayerDialogue(Expressions.NORMAL, "Tell me who you are first and why I'm here.");
		} else if (stage == 7) {
			stage = 8;
			sendPlayerDialogue(Expressions.NORMAL, "I was.. I was.. Hmmm..");	
		} else if (stage == 8) {
			stage = 9;
			sendPlayerDialogue(Expressions.NORMAL, "...");
		} else if (stage == 9) {
			stage = 10;
			sendPlayerDialogue(Expressions.NORMAL, "Well, I don't really know what I was doing before this but that's besides the point! Tell me who you are!");
		} else if (stage == 10) {
			stage = 11;
			sendEntityDialogue(SEND_4_TEXT_CHAT,new String[] {NPCDefinitions.getNPCDefinitions(npcId).name,"My name is not of importance. Time, space, locations, and memories.. They have no relevance on this point." }, IS_NPC,npcId, 9827);
		} else if (stage == 11) {
			stage = 12;
			sendPlayerDialogue(Expressions.NORMAL, "Okay.. Well what do you want with me?");
		} else if (stage == 12) {
			stage = 13;
			sendEntityDialogue(SEND_4_TEXT_CHAT,new String[] {NPCDefinitions.getNPCDefinitions(npcId).name,"I need you to go on an adventure in another dimension." }, IS_NPC,npcId, 9827);
		} else if (stage == 13) {
			stage = 14;
			sendPlayerDialogue(Expressions.NORMAL, "WHAT? Why me? There are another million of people outside! Why me?!");
		} else if (stage == 14) {
			stage = 15;
			sendEntityDialogue(SEND_4_TEXT_CHAT,new String[] {NPCDefinitions.getNPCDefinitions(npcId).name,"Do not underestimate yourself.. You are not like most people. You are not an ordinary human." }, IS_NPC,npcId, 9827);
		} else if (stage == 15) {
			stage = 16;
			sendEntityDialogue(SEND_4_TEXT_CHAT,new String[] {NPCDefinitions.getNPCDefinitions(npcId).name,"Time is running out, adventurer. This dimension will collapse soon.. " }, IS_NPC,npcId, 9827);
            player.getPackets().sendCameraShake(3, 25, 50,25, 50);
		} else if (stage == 16) {
			stage = 17;
			sendEntityDialogue(SEND_4_TEXT_CHAT,new String[] {NPCDefinitions.getNPCDefinitions(npcId).name,"I will navigate you to another world. Don't worry, you won't be alone. You will meet others of your specie. You will discover unseen creatures and unseen powers. But, you will have to obey to the rules of that dimension." }, IS_NPC,npcId, 9827);
		} else if (stage == 17) {
			stage = 18;
			sendEntityDialogue(SEND_4_TEXT_CHAT,new String[] {NPCDefinitions.getNPCDefinitions(npcId).name,"Now, child of Geryon. Go and do not disappoint me." }, IS_NPC,npcId, 9827);
		} else if (stage == 18) {
			controler.forceClose();
			player.setNextWorldTile(new WorldTile(Settings.RESPAWN_PLAYER_LOCATION));
			player.getPackets().sendStopCameraShake();		
			player.getInterfaceManager().sendWelcomeInterface();
			end ();
		}
	}

	@Override
	public void finish() {

	}

}

